package com.zygh.policeasset.controller;

import com.github.pagehelper.PageInfo;
import com.zygh.policeasset.component.CommonResult;
import com.zygh.policeasset.pojo.AuditDataDTO;
import com.zygh.policeasset.pojo.AuditFlow;
import com.zygh.policeasset.pojo.AuditFlowDetail;
import com.zygh.policeasset.service.AuditFlowService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = {"审批"})
@RequestMapping({"/auditFlow"})
@RestController
/* loaded from: police-asset-2.0-0.0.1-SNAPSHOT.jar:BOOT-INF/classes/com/zygh/policeasset/controller/AuditFlowController.class */
public class AuditFlowController {
    @Autowired
    AuditFlowService auditFlowService;

    @PostMapping({"/submitOrApproval"})
    @ApiOperation("提交或审批")
    public Object submitOrApproval(@RequestBody AuditDataDTO auditDataDTO) {
        return this.auditFlowService.submitOrApproval(auditDataDTO);
    }

    @ApiImplicitParams({@ApiImplicitParam(name = "userId", value = "操作人", required = false, paramType = "query"), @ApiImplicitParam(name = "status", value = "0是我申请的、2待我审批、3我通过的、4我驳回的,", required = false, paramType = "query")})
    @GetMapping({"/queryAudit"})
    @ApiOperation("待办查询")
    public PageInfo queryAudit(@RequestParam(defaultValue = "1", value = "pageNum") int pageNum, @RequestParam(defaultValue = "10", value = "pageSize") int pageSize, @RequestParam(value = "userId", required = false) Integer userId, @RequestParam(value = "status", required = false) Integer status, @RequestParam(value = "tableType", required = false) String tableType, @RequestParam(value = "applicant", required = false) Integer applicant) {
        return this.auditFlowService.queryAudit(pageNum, pageSize, userId, status, tableType, applicant);
    }

    @ApiResponses({@ApiResponse(code = 200, message = "noAuditFlowCount是待我审批个数;unReadCount是未读个数", response = CommonResult.class)})
    @ApiImplicitParams({@ApiImplicitParam(name = "userId", value = "登录人", paramType = "query")})
    @ApiOperation("查询未审批个数和未读个数")
    @GetMapping({"/queryCount"})
    public Object queryCount(@RequestParam("userId") Integer userId) {
        return this.auditFlowService.queryCount(userId);
    }

    @GetMapping({"/queryById"})
    @ApiOperation("通过id查询")
    public AuditFlow queryById(@RequestParam(value = "id", required = false) Integer id) {
        return this.auditFlowService.queryById(id);
    }

    @GetMapping({"/queryByFlowNo"})
    @ApiOperation("通过flowNo查询")
    public List<AuditFlowDetail> queryByFlowNo(@RequestParam(value = "flowNo", required = false) String flowNo, @RequestParam(value = "tableType", required = false) String tableType) {
        return this.auditFlowService.queryByFlowNo(flowNo, tableType);
    }
}